import Vue from 'vue'
import App from './App'
import store from './components/vuex/store'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
var router = new VueRouter()


router.map({
	'/login': {
		name: "login",
		component: function(resolve) {
			require(['./components/main/Login'], resolve)
		}
	},
	'/main': {
		component: function(resolve) {
			require(['./components/view/main'], resolve)
		},
		subRoutes: {
			'/': { 
				name: 'viewone',
				component: function(resolve) {
					require(['./components/content/ViewOne'], resolve)
				}
			},
			'/hello': {
				name: 'hello',
				component: function(resolve) {
					require(['./components/content/Hello'], resolve)
				}
			},
			'/userHome': { 
				name: 'userHome',
				component: function(resolve) {
					require(['./components/content/UserHome'], resolve)
				}
			},
		}
	},
})

//挂载到#app
router.start(App, "#app")


require('./assets/css/style.css')
require('./assets/css/vux-zhuangchang.css')
require('./assets/css/font-awesome.css')


/* eslint-disable no-new */
new Vue({
	store,
	el: 'body',
  	components: { App }
})

//路由重定向：除了路由配置的地址全部跑/main页面
router.redirect({ 
	'*': '/main'
})

